<?php ob_start(); ?> 
<?php header ('Content-type: text/xml; charset=utf-8'); ?>     

<?php include "constants.inc" ?>

<?php session_start(); ?> 

<?php

function getTeamId() {

	if (isset($_GET['teamId'])) {

		return $_GET['teamId'];

	}

	return '';

}



function changeTeamName() {



	$teamId = getTeamId();

	if (isset($_GET['name'])) {

		$name = $_GET['name'];

	}

	

	if (isset($teamId) && isset($name)) {

	    $connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);

		mysql_select_db(DB_CATALOG);



		$query = "update zt_team set team_name = '".$name."' where team_id = ".$teamId;

	    $result = mysql_query($query, $connect);

	    $affectedRows = mysql_affected_rows($result);

	    if ($affectedRows == 1) {

	    	return '0';

	    }

    }



  	return "Naam niet gewijzigd!";

}

?>

<response>

  <method>changeTeamName</method>

  <teamId><?php echo getTeamId() ?></teamId>

  <result><?php echo changeTeamName() ?></result>

</response>